﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Entities.SM
{

    /// <summary>
    /// 出库记录
    /// </summary>
    public class StockOut : BaseEntity<string>
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public override string? Id { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string? MaterCode { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string? MaterName { get; set; }

        /// <summary>
        /// 物料分类
        /// </summary>
        public string? MaterType { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        public string? WarehouseID { get; set; }

        /// <summary>
        /// 仓库名称
        /// </summary>
        public string? WarehouseName { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public string? LocationID { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        public string? LocationName { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 出库数量
        /// </summary>
        public decimal? OutQuantity { get; set; }

        /// <summary>
        /// 出库时间
        /// </summary>
        public DateTime? OutTime { get; set; }

        /// <summary>
        /// 出库类型
        /// </summary>
        public string? OutType { get; set; }

        /// <summary>
        /// 出库批次号
        /// </summary>
        public string? OutBatchCode { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string? Spec { get; set; }

        /// <summary>
        /// 筒仓编码
        /// </summary>
        public string? SiloCode { get; set; }

        /// <summary>
        /// 筒仓名称
        /// </summary>
        public string? SiloName { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsDeleted { get; set; }

        #region 拓展字段
        /// <summary>
        /// 时间范围
        /// </summary>
        [NotMapped]
        public string? OutTimeScope { get; set; }

        #endregion
        public StockOut()
        {
            // 如果ID为空，自动生成GUID
            if (string.IsNullOrEmpty(Id))
            {
                Id = Guid.NewGuid().ToString();
            }
        }
    }
}